package com.guldan.jaina.utils;

import com.guldan.core.utils.DateUtil;
import com.guldan.jaina.dto.household.HouseholdDTO;
import com.guldan.jaina.dto.householdareainfo.HouseholdAreaInfoDTO;
import com.guldan.jaina.dto.householdproperty.HouseholdPropertyDTO;
import com.guldan.mapper.db.entity.Household;
import com.guldan.mapper.db.entity.HouseholdAreaInfo;
import com.guldan.mapper.db.entity.HouseholdProperty;

/**
 * Created by Silas.
 * Date: 2016/11/7
 * Time: 22:34
 */
public class HouseholdDomainConvertUtils {


    public static HouseholdDTO convert(Household entity) {
    	HouseholdDTO dto = new HouseholdDTO();
    	dto.setHouseholdId(entity.getHouseholdId());
    	dto.setHouseholdNumber(entity.getHouseholdNumber());
    	dto.setHouseholdRegisterNumber(entity.getHouseholdRegisterNumber());
    	dto.setHouseholdTypeCode(entity.getHouseholdTypeCode());
    	dto.setRemark(entity.getRemark());    	
    	dto.setCreateTime(DateUtil.toLocaleString(entity.getCreateTime(), DateUtil.YYYY_MM_DD_HH_DD_SS));
    	dto.setCreator(entity.getCreator());
    	dto.setDelete(entity.getIsDelete());
    	dto.setDisabled(entity.getDisabled());
    	dto.setModifier(entity.getModifier());
    	dto.setModifyTime(DateUtil.toLocaleString(entity.getModifyTime(), DateUtil.YYYY_MM_DD_HH_DD_SS));
    	
        return dto;
    }

	public static HouseholdAreaInfoDTO convert(HouseholdAreaInfo entity) {
		HouseholdAreaInfoDTO dto = new HouseholdAreaInfoDTO();
		dto.setHouseholdAreaInfoId(entity.getHouseholdAreaInfoId());
		dto.setHouseholdId(entity.getHouseholdId());
		dto.setFarmToForestNumber(entity.getFarmToForestNumber());
		dto.setFarmLandArea(entity.getFarmLandArea());
		dto.setFineBreedArea(entity.getFineBreedArea());
		dto.setEconomyArea(entity.getEconomyArea());
		dto.setAgriculturalArea(entity.getAgriculturalArea());
		dto.setFillGrassArea(entity.getFillGrassArea());
		dto.setForestEcologyArea(entity.getForestEcologyArea());
		dto.setPlainsEcologyArea(entity.getPlainsEcologyArea());
		dto.setConsolidateReturnArea(entity.getConsolidateReturnArea());
		dto.setPlainsGrazingArea(entity.getPlainsGrazingArea());
		dto.setReturnArea(entity.getReturnArea());
		dto.setReservoirsMove(entity.getReservoirsMove());

		dto.setCreateTime(DateUtil.toLocaleString(entity.getCreateTime(), DateUtil.YYYY_MM_DD_HH_DD_SS));
		dto.setCreator(entity.getCreator());
		dto.setDelete(entity.getIsDelete());
		dto.setDisabled(entity.getDisabled());
		dto.setModifier(entity.getModifier());
		dto.setModifyTime(DateUtil.toLocaleString(entity.getModifyTime(), DateUtil.YYYY_MM_DD_HH_DD_SS));

		return dto;
	}

	public static HouseholdPropertyDTO convert(HouseholdProperty entity) {
		HouseholdPropertyDTO dto = new HouseholdPropertyDTO();
		dto.setHouseholdPropertyId(entity.getHouseholdPropertyId());
		dto.setLow(entity.getIsLow());
		dto.setLowAmount(entity.getLowAmount());
		dto.setFive(entity.getIsFive());
		dto.setFiveTypeCode(entity.getFiveTypeCode());
		dto.setDifficult(entity.getIsDifficult());
		dto.setDestitute(entity.getIsDestitute());
		dto.setPlains(entity.getIsPlains());
		dto.setSjyDifficult(entity.getIsSjyDifficult());
		dto.setSjyFuel(entity.getIsSjyFuel());
		dto.setForestEcology(entity.getIsForestEcology());
		dto.setApplyEcologySum(entity.getApplyEcologySum());
		dto.setEcologyRemark(entity.getEcologyRemark());
		dto.setHouseholdId(entity.getHouseholdId());

		dto.setCreateTime(DateUtil.toLocaleString(entity.getCreateTime(), DateUtil.YYYY_MM_DD_HH_DD_SS));
		dto.setCreator(entity.getCreator());
		dto.setDelete(entity.getIsDelete());
		dto.setDisabled(entity.getDisabled());
		dto.setModifier(entity.getModifier());
		dto.setModifyTime(DateUtil.toLocaleString(entity.getModifyTime(), DateUtil.YYYY_MM_DD_HH_DD_SS));

		return dto;
	}

}
